//获取分页条（分页按钮栏的规则和样式根据自己的需要来设置）
function getPageBar()
{
  totalPage=Math.ceil(totalItem/pageSize);
  if(curPage > totalPage) {
    curPage = totalPage;
  }
  if(curPage < 1) {
    curPage = 1;
  }
 
  pageBar = "";
 
  //如果不是第一页
  if(curPage != 1){
    pageBar += "<span class='pageBtn'><a href='javascript:turnPage(1)'>首页</a></span>";
    pageBar += "<span class='pageBtn'><a href='javascript:turnPage("+(curPage-1)+")'><<</a></span>";
  }
 
  //显示的页码按钮(5个)
  var start,end;
  if(totalPage <= 5) {
    start = 1;
    end = totalPage;
  } else {
    if(curPage-2 <= 0) {
        start = 1;
        end = 5;
    } else {
        if(totalPage-curPage < 2) {
            start = totalPage - 4;
            end = totalPage;
        } else {
            start = curPage - 2;
            end = curPage + 2;
        }
    }
  }
 
  for(var i=start;i<=end;i++) {
    if(i == curPage) {
        pageBar += "<span class='pageBtn-selected'><a href='javascript:void(0);'>"+i+"</a></span>";
    } else {
        pageBar += "<span class='pageBtn'><a href='javascript:turnPage("+i+")'>"+i+"</a></span>";
    }
  }
   
  //如果不是最后页
  if(curPage != totalPage&&totalPage>0){
    pageBar += "<span class='pageBtn'><a href='javascript:turnPage("+(parseInt(curPage)+1)+")'>>></a></span>";
    pageBar += "<span class='pageBtn'><a href='javascript:turnPage("+totalPage+")'>尾页</a></span>";
  }
     
  $("#pageBar").html(pageBar);
}